<%!

  Copyright 2016 Facebook, Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

%><%#service:functions%><%#function:returnType%>
<%#type:deprecated_stream?%>
  <%#type:streamElemType%>
    <%#type:resolves_to_complex_return?%>
void <%service:name%>SvIf::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::StreamingHandlerCallback<<% > types/unique_ptr_type%>>> callback<%function:comma%><% > service_common/function_param_list_commented_out%>) {
    <%/type:resolves_to_complex_return?%>
    <%^type:resolves_to_complex_return?%>
void <%service:name%>SvIf::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::StreamingHandlerCallback<<% > types/type%>>> callback<%function:comma%><% > service_common/function_param_list_commented_out%>) {
    <%/type:resolves_to_complex_return?%>
  <%/type:streamElemType%>
  callback->exception(folly::make_exception_wrapper<apache::thrift::TApplicationException>("Function <%function:name%> is unimplemented"));
}
<%/type:deprecated_stream?%>
<%^type:deprecated_stream?%>

<%^type:resolves_to_complex_return?%>
<% > types/type%> <%service:name%>SvIf::<%function:name%>(<% > service_common/function_param_list_commented_out%>) {
  apache::thrift::detail::si::throw_app_exn_unimplemented("<%function:name%>");
}

folly::Future<<% > types/service_type%>> <%service:name%>SvIf::future_<%function:name%>(<% > service_common/function_param_list%>) {
  return apache::thrift::detail::si::future([&] { return <%function:name%>(<% > service_common/param_list_move%>); });
}

<%#function:oneway?%>
void <%service:name%>SvIf::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallbackBase> callback<%function:comma%><% > service_common/function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_oneway(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return future_<%function:name%>(<% > service_common/param_list_move%>); });
}
<%/function:oneway?%>
<%^function:oneway?%>
void <%service:name%>SvIf::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallback<<% > types/type%>>> callback<%function:comma%><% > service_common/function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return future_<%function:name%>(<% > service_common/param_list_move%>); });
}
<%/function:oneway?%>
<%/type:resolves_to_complex_return?%>
<%#type:resolves_to_complex_return?%>
void <%service:name%>SvIf::<%function:name%>(<% > types/type%>& /*_return*/<%function:comma%><% > service_common/function_param_list_commented_out%>) {
  apache::thrift::detail::si::throw_app_exn_unimplemented("<%function:name%>");
}

folly::Future<<% > types/unique_ptr_type%>> <%service:name%>SvIf::future_<%function:name%>(<% > service_common/function_param_list%>) {
  return apache::thrift::detail::si::future_returning<%^type:stack_arguments?%>_uptr<%/type:stack_arguments?%>([&](<% > types/type%>& _return) { <%function:name%>(_return<%function:comma%><% > service_common/param_list_move%>); });
}

void <%service:name%>SvIf::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallback<<% > types/unique_ptr_type%>>> callback<%function:comma%><% > service_common/function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return future_<%function:name%>(<% > service_common/param_list_move%>); });
}
<%/type:resolves_to_complex_return?%>
<%#service:frozen2?%>

<%^type:resolves_to_complex_return?%>
<% > types/type%> <%service:name%>SvIf::frozen2_<%function:name%>(<% > service_common/frozen2_function_param_list%>) {
  return <%function:name%>(<% > service_common/frozen2_param_list_thaw%>);
}

folly::Future<<% > types/service_type%>> <%service:name%>SvIf::frozen2_future_<%function:name%>(<% > service_common/frozen2_function_param_list%>) {
  return apache::thrift::detail::si::future([&] { return frozen2_<%function:name%>(<% > service_common/frozen2_param_list_move%>); });
}
<%#function:oneway?%>
void <%service:name%>SvIf::frozen2_async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallbackBase> callback<%function:comma%><% > service_common/frozen2_function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_oneway(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/frozen2_param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return frozen2_future_<%function:name%>(<% > service_common/frozen2_param_list_move%>); });
}
<%/function:oneway?%>
<%^function:oneway?%>
void <%service:name%>SvIf::frozen2_async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallback<<% > types/type%>>> callback<%function:comma%><% > service_common/frozen2_function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/frozen2_param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return frozen2_future_<%function:name%>(<% > service_common/frozen2_param_list_move%>); });
}
<%/function:oneway?%>
<%/type:resolves_to_complex_return?%>
<%#type:resolves_to_complex_return?%>
void <%service:name%>SvIf::frozen2_<%function:name%>(<% > types/type%>& _return<%function:comma%><% > service_common/frozen2_function_param_list%>) {
  return <%function:name%>(_return<%function:comma%><% > service_common/frozen2_param_list_thaw%>);
}

folly::Future<<% > types/unique_ptr_type%>> <%service:name%>SvIf::frozen2_future_<%function:name%>(<% > service_common/frozen2_function_param_list%>) {
  return apache::thrift::detail::si::future_returning_uptr([&](<% > types/type%>& _return) { frozen2_<%function:name%>(_return<%function:comma%><% > service_common/frozen2_param_list_move%>); });
}

void <%service:name%>SvIf::frozen2_async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>_<%function:name%>(std::unique_ptr<apache::thrift::HandlerCallback<<% > types/unique_ptr_type%>>> callback<%function:comma%><% > service_common/frozen2_function_param_list%>) {
  apache::thrift::detail::si::async_<%#function:eb%>eb<%/function:eb%><%^function:eb%>tm<%/function:eb%>(this, std::move(callback), <%#function:eb%>[this<%function:comma%><% > service_common/frozen2_param_list_move_assignment%>]() mutable<%/function:eb%><%^function:eb%>[&]<%/function:eb%> { return frozen2_future_<%function:name%>(<% > service_common/frozen2_param_list_move%>); });
}
<%/type:resolves_to_complex_return?%>
<%/service:frozen2?%>
<%/type:deprecated_stream?%>
<%/function:returnType%><%/service:functions%>
